package com.baomidou.samples.jpa.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.samples.jpa.dao.StudentRepository;
import com.baomidou.samples.jpa.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentRepository studentRepository;

    @Override
    @DS("slave_2")
    public List<Student> selectAllStudents() {
        return studentRepository.findAll();
    }
}
